package com.example.perplonews.a_d_fragment.c_video.adapter

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.example.perplonews.R
import com.example.perplonews.a_b_utils.LjlUtils
import com.example.perplonews.a_d_fragment.c_video.entity.VideoNewsEntity
import com.example.perplonews.a_d_fragment.c_video.entity.Video_url
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
import org.w3c.dom.Text

class Video_Rec_Adapter(var list: ArrayList<VideoNewsEntity.Values>) :
    RecyclerView.Adapter<Video_Rec_Adapter.VideoHolder>() {
    companion object{
        var mGSYVideo: StandardGSYVideoPlayer? = null
    }


    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VideoHolder {
        var inflate = LayoutInflater.from(parent.context).inflate(R.layout.recom_video, null)
        return VideoHolder(inflate)
    }

    override fun onBindViewHolder(holder: VideoHolder, position: Int) {
        holder.text?.setText(list[position].news_title)
       mGSYVideo?.setUp(Video_url.getvideourl(position), true, "")


    }


    override fun getItemCount(): Int {
        return list.size
    }

    class VideoHolder : RecyclerView.ViewHolder {

        var text:TextView?=null

        constructor(mView: View) : super(mView) {
            mGSYVideo = mView.findViewById(R.id.recom_gsy)
            text = mView.findViewById(R.id.recom_tex)
        }
    }


}